import 'package:get/get.dart';
import 'package:smart_devices/model/message.dart';

class MessageListLogic extends GetxController with ScrollMixin {
  RxInt tabIndex = RxInt(0);

  RxList<MessageModel> pageList = RxList([]);

  @override
  void onInit() {
    super.onInit();
    pageList.add(MessageModel(
        title: '您有一个保养任务，请及时处理。',
        rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
        addTime: '2023-11-24 11:22:44',
        status: MessageStatusEnum.unread,
        type: MessageTypeEnum.upkeepTask));
    pageList.add(MessageModel(
        title: '您有故障报修需要审核，请及时处理。',
        rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
        addTime: '2023-11-24 11:22:44',
        status: MessageStatusEnum.unread,
        type: MessageTypeEnum.faultAudit));
    pageList.add(MessageModel(
        title: '您有背景领用需要审核，请及时处理。',
        rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
        addTime: '2023-11-24 11:22:44',
        applicant: '赵子龙',
        status: MessageStatusEnum.unread,
        type: MessageTypeEnum.spareReceiveAudit));
    pageList.add(MessageModel(
        title: '您有一个维修工单，请及时处理。',
        rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
        addTime: '2023-11-24 11:22:44',
        status: MessageStatusEnum.unread,
        type: MessageTypeEnum.repairOrder));
    pageList.add(MessageModel(
        title: '您有一个巡检任务，请及时处理。',
        rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
        addTime: '2023-11-24 11:22:44',
        status: MessageStatusEnum.unread,
        type: MessageTypeEnum.inspectionTask));
  }

  @override
  Future<void> onEndScroll() {
    return Future<void>.delayed(const Duration(seconds: 1), () {
      pageList.add(MessageModel(
          title: '您有一个巡检任务，请及时处理。',
          rangeTime: '2023-06-02 09:00~2023-06-02 09:00',
          addTime: '2023-11-24 11:22:44',
          status: MessageStatusEnum.unread,
          type: MessageTypeEnum.inspectionTask));
    });
  }

  @override
  Future<void> onTopScroll() {
    return Future<void>.delayed(const Duration(seconds: 1), () {

    });
  }
}
